package com.ddpt.permission.mapper;

import com.lh.center.common.base.BizMapper;
import com.lh.center.common.enums.MerchantServiceType;
import com.lh.center.permission.api.entity.Permission;
import com.lh.center.permission.api.request.PermissionQueryRequest;
import com.lh.center.permission.api.session.SessionPermission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author czy
 * @since 2022-04-07
 */
public interface PermissionMapper extends BizMapper<Permission> {

    List<SessionPermission> querySessionPermissionByRole(Long roleId);

    /**
     * 查询指定应用权限下的商户后台所有权限
     * @param merchantServiceList 指定的应用权限
     * @return
     */
    List<SessionPermission> queryMerchantPermissionByMerchantService(@Param("services") List<MerchantServiceType> merchantServiceList);

    /**
     * 查询指定角色和应用权限下的商户后台权限
     * @param roleId 角色id
     * @param insServiceList 指定应用权限
     * @return
     */
    List<SessionPermission> queryMerchantPermissionByRoleAndMerchantService(@Param("roleId") Long roleId,@Param("services") List<MerchantServiceType> insServiceList);

    List<SessionPermission> queryNormalSessionPermission(@Param("serviceList") List<MerchantServiceType> serviceList);

    List<SessionPermission> queryListByAdminServiceAndMerchantService(PermissionQueryRequest queryRequest);
}
